﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TeacherList.aspx.cs" Inherits="Presentation.Teacher_List" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Teacher List</title>
    <style type="text/css">
        .style1
        {
            color: #0000FF;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="style1">
    
        Teacher&nbsp; List<br />
        <br />
        <asp:Button ID="Button_Create" runat="server" Text="Create New Teacher" 
            onclick="Button_Create_Click" />
    
        <br />
        <br />
        <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" 
            GridLines="None" AutoGenerateColumns="False" 
            onrowcommand="GridView1_RowCommand" >
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            <Columns>
            <asp:BoundField DataField="TeacherId"  HeaderText="Teacher Id" />
            <asp:BoundField DataField="TeacherName" HeaderText="Teacher Name" />
            <asp:BoundField DataField="TeacherGender" HeaderText="Teacher Gender" />

            <asp:TemplateField HeaderText="Department" > <%--嵌套绑定--%>
                <ItemTemplate>
                    <asp:Label  ID="labDepartmentName" Text='<%# DataBinder.Eval(Container.DataItem,"DepartMent.DepartmentName") %>' runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField HeaderText="Operation">
                    <ItemTemplate>
                        <asp:Button ID="UpdateButton" runat="server" CausesValidation="false" 
                            CommandName="Update" Text="Update" CommandArgument='<%# Eval("TeacherId") %>' />
                            <asp:Button ID="DeleteButton" runat="server" CausesValidation="false" 
                            CommandName="DeleteRow" Text="Delete" CommandArgument='<%# Eval("TeacherId") %>' OnClientClick="return confirm('confirm to Delete?')" />
                    </ItemTemplate>
                    
            </asp:TemplateField>
               
            </Columns>
        </asp:GridView>
        <br />
    
    </div>
    </form>
</body>
</html>
